#include <QStringList>
#include "aed_script.h"

AED_Script::AED_Script():m_path("NONAME"),m_name("NONAME")
{

}

AED_Script::AED_Script(const AED_Script& script){
    m_path = script.m_path;
    m_name = script.m_name;
}

AED_Script& AED_Script::operator=(const AED_Script& script){
    m_path = script.m_path;
    m_name = script.m_name;

    return *this;
}

void AED_Script::Load(const QString path){
    m_path = path;
    QStringList split = m_path.split("/");
    m_name = split.back();
}

QString AED_Script::GetPath(){
    return m_path;
}

void AED_Script::SetPath(const QString &path){
    m_path = path;
}

QString AED_Script::GetName(){
    return m_name;
}

void AED_Script::Save(QTextStream &file){
    file << "<script>" << endl;
    file << "   <path = " << m_path << ">" << endl;
    file << "   <name = " << m_path << ">" << endl;
    file << "</script>"<<endl<<endl<<endl;
}

void AED_Script::Save(QDomDocument &doc, QDomElement &header){
    QDomElement elem = doc.createElement("script");
    elem.setAttribute("path",m_path);
    elem.setAttribute("name",m_name);
    header.appendChild(elem);
}


